import { GET, POST } from '@/service';

/**
 * 获取抖音授权二维码
 * @param {*} params
 * @returns Promise
 */
export const getDyAuth = (params) => {
	const url = '/api/dy/agent/qrImage';

	return GET(url, params);
};

/**
 * 设置默认账号
 * @param {*} params
 * clientUserId(用户id(非必传))	
	id	(唯一id)
 * @returns Promise
 */

export const setDefaultAccount = (params) => {
	const url = '/api/dy/account/default';

	return POST(url, params);
};

/**
 * 修改-完善抖音信息
 * @param {*} params
 * 
	"cargoLevel": "",
	"cargoPoints": "",
	"channelAccount": "",
	"channelFens": 0,
	"clientUserId": 0,
	"dyUrl": "",
	"groupBuyRangeImg": "",
	"id": 0,
	"nickName": ""
 * @returns Promise
 */

export const dyAccountEdit = (params) => {
	const url = '/api/dy/account/edit';

	return POST(url, params);
};

/**
 * 抖音账号列表
 * @param {*} params
 * @returns Promise
 */
export const dyAccountList = (params) => {
	const url = '/api/dy/account/list';

	return GET(url, params);
};

/**
 * 达人解绑抖音账号
 * @param {*} params
 * @returns Promise
 */
export const dyAccountUnbind = (params) => {
	const url = '/api/dy/account/unbind';

	return POST(url, params);
};

/**
 * 抖音账号列表
 * @param {*} params
 * @returns Promise
 */
export const dyAccountItem = (params) => {
	const url = `/api/dy/account/detail`;

	return GET(url + '/' + params);
};

/**
 * 检查是否绑定抖音账号(以及抖音账号是否完善)
 * @param {*} params
 * @returns
 */

export const checkDyAuth = (params) => {
	const url = '/api/dy/account/checkDyAccount';

	return GET(url, params);
};

/**
 * 新用户检查是否绑定抖音账号
 * @param {*} params
 * @returns checkStatus	抖音账号状态:0-没有绑定抖音账号，1-已绑定抖音号，2-默认抖音账号信息不完善,4-默认抖音账号信息完整
 */
export const checkNewDyBind = (params) => {
	const url = '/api/dy/account/isBoundDyAccount';

	return GET(url, params);
};

/**
 * 检查是否有新增的授权的抖音账号-轮循
 * @param {*} params
 * @returns
 */
export const checkDyAccountNum = (params) => {
	const url = `/api/dy/account/checkDyAccountNum`;

	return GET(url + '/' + params);
};

// 达运抖音账号列表
// 127.0.0.1:8080/api/dy/agent/expand/list?expandDate&operateId=1&pageIndex=1&pageSize=10
export const agentListUrl = (params) => {
	const url = `/api/dy/agent/expand/list`;

	return GET(url, params);
};

// 达运抖音账号jmv统计
// 127.0.0.1:8080/api/dy/agent/expand/gmv?expandDate&operateId=1
export const agentGmvDataUrl = (params) => {
	const url = `/api/dy/agent/expand/gmv`;

	return GET(url, params);
};

// 达运已拓展人数
// 127.0.0.1:8080/api/dy/agent/expand/num?operateId=1
export const agentNumUrl = (params) => {
	const url = `/api/dy/agent/expand/num`;

	return GET(url, params);
};
